<template>
  <el-dialog width="800px" :close-on-click-modal="false" :visible.sync="visible" center @close="onClose">
    <template v-slot:title>
      <h2>【{{ examName }}】考试试题正确率统计分析表</h2>
    </template>
    <data-table ref="dtb" :api-setting="apiSetting" pagination>
      <el-table-column
        fixed
        prop="subName"
        label="所属科目"
        width="150"
        show-overflow-tooltip
      />
      <el-table-column
        prop="chapterName"
        label="所属章节"
        width="150"
        show-overflow-tooltip
      />
      <el-table-column
        prop="qusTypeId"
        label="题型"
        width="120"
        show-overflow-tooltip
      >
        <template slot-scope="{ row }">
          {{ getQueType(row.qusTypeId) }}
        </template>
      </el-table-column>
      <el-table-column prop="queTitle" label="试题内容" show-overflow-tooltip />
      <el-table-column
        prop="correctRate"
        label="正确率"
        width="80"
        show-overflow-tooltip
      >
        <template slot-scope="{ row }">
          {{ row.correctRate || "0%" }}
        </template>
      </el-table-column>
    </data-table>
  </el-dialog>
</template>

<script>
import dialog from "@/mixins/component/dialog";
import { queType, getQueType } from "../../../../staticData/queType";

export default {
  name: "answer",
  mixins: [dialog],
  data() {
    return {
      apiSetting: {
        method: "post",
        url: "/sys/examAnalysis/getQuestionAnalysis",
        data: {
          paperId: 0,
          examId: 0
        }
      },
      queType,
      examName: ""
    };
  },
  methods: {
    getQueType,
    setParams(paperId, examId, reload = true) {
      this.apiSetting.data.paperId = paperId;
      this.apiSetting.data.examId = examId;
      if (this.$refs.dtb && reload) {
        this.$refs.dtb.loadData();
        return;
      }
    }
  }
};
</script>

<style scoped></style>
